{extend name="common/header_user"}
{block name="body"}
<div class="personal">
    <div class="centerBox clearBoth">
        <div class="personal_l">
            <div class="personal_l_a">
                <div class="showimg">
                    <img src="{$userInfo.headimg|default='__ROOT__/home/images/yhm.png'}" alt="">
                </div>
                <h3>{$userInfo.nickname}</h3>
            </div>
            {include file="common/left_menu" /}
        </div>
        <div class="personal_r">
            <div class="main_name">
                短消息
            </div>
            <div class="personal_r_p1 layui-hide">
                <div class="msg1">
                    <ul>
                        <li class="msg1_fax">
                            <input name="" placeholder="2022-03-03—2022-03-13">
                            <img src="__ROOT__/home/images/b_03.png" alt="">
                        </li>
                        <li class="msg1_seatch">
                            <form>
                                <input type="text" class="seach_text" placeholder="请输入关键词">
                                <input type="submit" class="seach_submit" >
                            </form>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="personal_r_p2">
                 <ul>

                     <li class="tek_1">
                         <dl>
                             <dd>
                                 发送时间
                             </dd>
                             <dd>
                                标题
                             </dd>
                             <dd>

                             </dd>
                         </dl>
                     </li>
                     {foreach $msgList AS $k => $v}
                     <li>
                         <dl>
                             <dd>
                                 {$v.create_at}
                             </dd>
                             <dd>
                                 {if $v.is_new == 1}<span>new</span>{/if} <a class="msgOpenContent">{$v.title}</a>
                             </dd>
                             <dd>
                                 <input type="submit" value="删除" data-id="{$v.id}" data-confirm="确认删除该消息？" class="delMsg">
                             </dd>
                         </dl>
                         <div class="msgContent">
                             <div class="layui-card-body think-box-shadow padding-left-40">
                                 <div class="layui-form-item layui-row layui-col-space15">
                                     <label class="layui-col-xs12 relative">
                                         <span class="color-green block">消息内容</span>
                                         {$v.content|raw|nl2br}
                                     </label>
                                 </div>
                                 <div class="layui-form-item text-center">
                                     <button class="layui-btn layui-btn-danger close_box" type='button'>关闭</button>
                                 </div>
                             </div>

                         </div>
                     </li>
                     {/foreach}

                 </ul>
                {$page|raw}
            </div>
        </div>
    </div>
</div>
{/block}

{block name='script'}
<script>
    //开启弹窗并赋值表单
    $(".msgOpenContent").click(function(){
        $(this).parent().parent().next().show();

    });

    //关闭弹窗
    $(".close_box").click(function(){
        $(this).parent().parent().parent().hide();

    });

    $(".delMsg").click(function(){
        var id = $(this).data("id");
        layer.confirm('确定删除该信息？', {
            btn: ['确定','取消'] //按钮
        }, function(index){
            layer.close();

            $.ajax({
                type:'post',
                url:"/index/member/msg_del",
                data: {id:id},  //重点必须为一个变量如：data
                dataType:'json',
                success:function(data){
                    if (data.code > 0) {
                        layer.msg(data.info, {
                            icon: 6,
                            time: 1500 //2秒关闭（如果不配置，默认是3秒）
                        }, function () {
                            // window.location.href = "/index/Index/index";
                            window.location.reload();
                        });
                    }

                },
            })
            layer.close(index);
        }, function(){
        });
        return false;
    });
</script>
{/block}
